//参数逐个传递来实现参数的累加。
// let params = [1, 2, 3, 4, 5];
// function add() {
//   let sum = 0;
//   for (let i = 0; i < arguments.length; i++) {
//     sum += arguments[i];
//   }
//   return sum;
// }
// console.log(add(params)); //01,2,3,4,5
// console.log(add.apply(null, params)); //15
// console.log(add(...params)); //15

function multiply(a,b,c=1){
  return a*b*c;
}
console.log(multiply(...[1,2]));//2
console.log(multiply(...[1,2,3]));//6
console.log(multiply(...[1,2,3,4]));//6
console.log(multiply(...[1,2,3,4,5]));//6